package com.gm.wj.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;

/**
 * @program: wj
 * @description: 最近更新
 * @author: Huang_shengjun
 * @create: 2020-12-10 17:20
 **/
@Data
@Entity
@Table(name = "sys_news")
@ToString
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
// 软删除
@SQLDelete(sql = "update sys_news set is_delete = 1 where id = ?")
@Where( clause = "is_delete = 0" )
public class SysNews {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;

    /**
     * 最近更新内容
     */
    @NotEmpty(message = "最近更新内容不能为空")
    private String newContent;

    private String username;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 0-未删除，1-已删除
     */
    /**
     * 软删除
     */
    @Column(name = "is_delete")
    private int isDelete;

}

